package com.icss.th.db.tools.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.icss.th.db.tools.LuceneIndex;

/**
 * Servlet implementation class LuceneIndexServlet
 */
@WebServlet("/LuceneIndexServlet")
public class LuceneIndexServlet extends HttpServlet 
{
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		String indexType = request.getParameter("type");
		LuceneIndex luceneIndex = new LuceneIndex();
		
		if("exam".equals(indexType))
		{
			luceneIndex.createIndexExam();
		}
		else if("paper".equals(indexType))
		{
			luceneIndex.createIndexPaper();
		}
	}
}
